package com.nsgf.library.ui.page;

import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Observer;
import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.RecyclerView;

import com.google.gson.JsonObject;
import com.kunminx.architecture.ui.page.DataBindingConfig;
import com.kunminx.architecture.ui.state.State;
import com.kunminx.binding_recyclerview.adapter.SimpleDataBindingAdapter;
import com.nsgf.library.data.bean.BusinessBean;
import com.nsgf.library.data.bean.ConfirmOrderBean;
import com.nsgf.library.data.response.ResponseStatus;
import com.nsgf.library.domain.request.AccountRequester;
import com.nsgf.library.ui.page.home.ManagerFragment;
import com.nsgf.library.ui.product.NewComersActivity;
import com.nsgf.library.utils.ToastUtils;
import com.zhht.htzx.BR;
import com.zhht.htzx.R;
import com.zhht.htzx.databinding.ActivityCouponListBinding;
import com.zhht.htzx.databinding.ActivityDirectSaleStoreListBinding;
import com.zhht.htzx.databinding.ItemCouponBinding;
import com.zhht.htzx.databinding.ItemHomeBusinessFragmentBinding;

import java.util.ArrayList;
import java.util.List;

/**
 * 直营店
 */
public class DirectSaleStoreListActivity extends BaseActivity {

    private StateHolder mStates;

    private SimpleDataBindingAdapter<ConfirmOrderBean.CouponsDTO, ItemCouponBinding> mAdapter;

    private AccountRequester mAccountRequester;

    @Override
    protected void initViewModel() {
        mStates = getActivityScopeViewModel(StateHolder.class);
        mAccountRequester = getActivityScopeViewModel(AccountRequester.class);
    }

    @Override
    protected DataBindingConfig getDataBindingConfig() {


        return new DataBindingConfig(R.layout.activity_direct_sale_store_list, BR.vm, mStates);
    }

    private ActivityDirectSaleStoreListBinding mBinding;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        getLifecycle().addObserver(mAccountRequester);
        mBinding = (ActivityDirectSaleStoreListBinding) getBinding();
        mStates.titleBar.set("直营店");
// 实例化Fragment
        ManagerFragment fragment = ManagerFragment.newInstance(0);

// 获取FragmentManager
        FragmentManager fragmentManager = getSupportFragmentManager();

// 开启一个事务
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();

// 将Fragment添加到容器中
        fragmentTransaction.add(R.id.fragment_container, fragment);

// 提交事务
        fragmentTransaction.commit();
    }
}
